/*
 * masterPutCycleSlave.h
 *
 *  Created on: 25/nov/2009
 *      Author: Aleph3
 */

#ifndef MASTERPUTCYCLESLAVE_H_
#define MASTERPUTCYCLESLAVE_H_
#include "masterCycle.h"

//segnali

#define ON_NOTIFY_MASTER_PACKET_PUT_DATA 5
#define ON_NOTIFY_MASTER_PACKET_PUT_END 6
#define ON_NOTIFY_MASTER_FAIL 7
extern Event masterPutCycleSlaveInitEvent;

//Notificatori

void NotifyMasterPutCycleSlavePacketPutData(void* target);
void NotifyMasterPutCycleSlavePacketPutEnd(void* target);
void NotifyMasterPutCycleSlaveFail(void* target);

//Stati

StateOutcome masterPutCycleSlavePacketReceivingState (void* me,const Event* e);
StateOutcome masterPutCycleSlaveEndTransactionState (void* me,const Event* e);
StateOutcome masterPutCycleSlaveFinishFailState (void* me,const Event* e);

//transizioni

void fromReceiveDataStateToReceiveDataState(void* me);

//Inizializzatore Trasmissione

void masterPutCycleSlaveInit(void* me,void* canPort, uint32_t msgId, uint8_t msgPayloadSize, uint8_t* msgPayload, uint32_t msgAnswer, Notifier onOk);

//tipo supporto evento init

typedef struct{
	uint16_t pPacket;
	void* contentBuffer;
} PutCycleSlaveInitData;

#endif /* MASTERPUTCYCLESLAVE_H_ */
